import { fromJS } from 'immutable'
import * as constants from './constants'

const defaultState = fromJS({
  orderStatusMap: {},
  currentPage: 1
})

export default (state = defaultState, action) => {
  const { type, value } = action
  switch (type) {
    case constants.SET_ORDER_STATUS:
      return state.set('orderStatusMap', value)
    case constants.SET_CURRENT_PAGE:
      return state.set('currentPage', value)
    default:
      return state
  }
}
